<template>
  <div class="view-container">
    <table-search-view :table-items="tableItems" :search-items="searchItems" :search-function="getTableDate">
      <template slot="orderId" slot-scope="scope">
        <el-button type="text" @click.stop.prevent="orderDetail(scope.row.orderNumber)">{{scope.row.orderNumber}}</el-button>
      </template>
    </table-search-view>
  </div>
</template>

<script>
  import TableSearchView from '@/components/TableSearchView';
  import {getCompensateRecords} from '@/api/assets';

  export default {
    name: 'assetsCompensation', //赔偿金管理
    components: {
      'table-search-view':TableSearchView,
    },
    data()
    {
      return {
        searchItems: [
          {
            label: '订单编号',
            type: 'input',
            placeholder:'请输入订单编号',
            model:'orderNumber',
          },
          {
            label: '申请赔偿时间',
            type: 'datetimerange',
            placeholder:'请选择申请赔偿时间',
            model:'timeRange',
          },
          {
            label: '账单ID',
            type: 'input',
            placeholder:'请输入账单ID',
            model:'billNumber',
          },
          {
            label: '下单用户',
            type: 'input',
            placeholder:'请输入下单用户',
            model:'userName',
          }
        ],
        tableItems:[
          {
            label:'赔偿账单ID',
            prop:'id',
            width:'200px;',
          },
          {
            label:'关联订单',
            prop:'orderNumber',
            width:'180px;',
            sortable:true,
            type:'scope',
            slot:'orderId',
          },
          {
            label:'商品名称',
            prop:'goodsName',
            width:'180px;',
            sortable:true,
          },
          {
            label:'用户',
            prop:'userName',
            width:'180px;',
            sortable:true,
          },
          {
            label:'赔偿金额',
            prop:'compensateAmount',
            width:'120px;',
            formatter:'parsePrice',
          },
          {
            label:'申请赔偿时间',
            prop:'createTime',
            width:'160px;',
            formatter:'parseTime',
          },
          {
            label:'赔偿流水号',
            prop:'compensateNumber',
            width:'280px;',
          },
          {
            label:'支付平台流水号',
            prop:'transactionNo',
            width:'240px;',
          },
          {
            label:'支付平台',
            prop:'payTypeStr',
            width:'120px;',
            sortable:true,
          },
          {
            label:'支付时间',
            prop:'compensateTime',
            width:'160px;',
            formatter:'parseTime',
          },
          {

          }
        ],
      }
    },
    methods: {
      getTableDate(data) //获取数据
      {
        return getCompensateRecords(data);
      },
      orderDetail(id)
      {
        this.$router.push({name:'orderInfo',query:{id:id}})
      }
    }
  }
</script>

<style lang="scss" scoped>

</style>
